//
//  advisoryTableViewCell.m
//  One Construction
//
//  Created by apple on 2019/9/7.
//  Copyright © 2019 apple. All rights reserved.
//

#import "advisoryTableViewCell.h"

@implementation advisoryTableViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style
                reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addSubview:self.leftLable];
        [self.leftLable mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_offset(12);
            make.top.mas_offset(18);
            make.width.mas_equalTo(60);
             make.height.mas_equalTo(23);
        }];
        
        [self addSubview:self.rightTextField];
        [self.rightTextField mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.leftLable.mas_right).mas_offset(6);
            make.top.mas_offset(18);
            make.width.mas_equalTo(300);
             make.height.mas_equalTo(23);
            
        }];
        
        self.rightTextField.userInteractionEnabled = YES
        ;
        [self.rightTextField addTarget:self action:@selector(clickTextFiled) forControlEvents:UIControlEventEditingChanged];
        
    }
        
    return self;

}
-(void)setIndex:(NSIndexPath *)index{
    
    _index  = index;
    
    
}
- (void)clickTextFiled{
    if ([_mydelegate respondsToSelector:@selector(clickTextFieldIndexPath:Str:)]) {
        [_mydelegate  clickTextFieldIndexPath:_index Str:self.rightTextField.text];
    }
    
    
    
    
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(myLable *)leftLable{
    if (!_leftLable) {
        _leftLable =[[myLable alloc]init];
        [_leftLable setLabletextColor:[UIColor colorWithRed:160/255.0 green:160/255.0 blue:160/255.0 alpha:1.0] Text:nil TextFont:16];
        
        
    }
        
    return _leftLable;
    
}

-(UITextField *)rightTextField{
    if (!_rightTextField) {
        _rightTextField = [[UITextField alloc]init];
        _rightTextField.textColor = [UIColor blackColor];
        
    }
    return _rightTextField;

}
@end
